{extend name="public/container"}
{block name="content"}
<link rel="stylesheet" href="{__ADMIN_PATH}css/mask.css">
<div class="layui-tab">
    <ul class="layui-tab-title">
        <li class="layui-this">分销参数</li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">分销开关</label>
                    <div class="layui-input-block">
                        <input type="radio" {if $data['is_open']==0}checked{/if} name="is_open" value="0"  title="关闭">
                        <input type="radio" {if $data['is_open']==1}checked{/if} name="is_open" value="1" title="开启" >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">三级分销开关</label>
                    <div class="layui-input-block">
                        <input type="radio" {if $data['three_open']==0}checked{/if} name="three_open" value="0"  checked="" title="关闭">
                        <input type="radio" {if $data['three_open']==1}checked{/if} name="three_open" value="1" title="开启" >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">分销方式</label>
                    <div class="layui-input-block">
                        <input type="radio" {if $data['agent_way']==1}checked{/if} name="agent_way" value="1"  checked="" title="指定分销">
                        <input type="radio" {if $data['agent_way']==2}checked{/if} name="agent_way" value="2" title="人人分销" >
                    </div>
                </div>
                <ins class="adsbygoogle" style="display:inline-block;width:970px;height:10px;background-color:#f5f5f5" data-ad-client="ca-pub-6111334333458862" data-ad-slot="3820120620"></ins>
                <h3 style="color: rebeccapurple">分销佣金：</h3>
                <div class="layui-form-item">
                    <label class="layui-form-label">一级分销佣金(%)</label>
                    <div class="layui-input-inline">
                        <input type="text"  value="{$data.one_percent}" name="one_percent"  placeholder="请输入一级分销佣金" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">二级分销佣金(%)</label>
                    <div class="layui-input-inline">
                        <input type="text" value="{$data.two_percent}"  name="two_percent"   placeholder="请输入二级分销佣金" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">三级分销佣金(%)</label>
                    <div class="layui-input-inline">
                        <input type="text" value="{$data.three_percent}"  name="three_percent"   placeholder="请输入二级分销佣金" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <ins class="adsbygoogle" style="display:inline-block;width:970px;height:10px;background-color:#f5f5f5" data-ad-client="ca-pub-6111334333458862" data-ad-slot="3820120620"></ins>
                <h3 style="color: rebeccapurple">充值成为分销商：</h3>
                <div class="layui-form-item">
                        <label class="layui-form-label">分销商充值(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" value="{$data.one_recharge}"   name="one_recharge"   placeholder="一级代理充值升级" autocomplete="off" class="layui-input">
                        </div>
                    <div class="layui-form-mid layui-word-aux">即充值多少元成为分销商</div>
                </div>
                <ins class="adsbygoogle" style="display:inline-block;width:970px;height:10px;background-color:#f5f5f5" data-ad-client="ca-pub-6111334333458862" data-ad-slot="3820120620"></ins>
                <h3 style="color: rebeccapurple">消费成为分销商：</h3>
                <div class="layui-form-item">
                    <label class="layui-form-label">分销商消费(元)</label>
                    <div class="layui-input-inline">
                        <input type="text" value="{$data.one_buy}"  name="one_buy" placeholder="一级代理消费升级" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">即消费多少元成为分销商</div>
                </div>
                <ins class="adsbygoogle" style="display:inline-block;width:970px;height:10px;background-color:#f5f5f5" data-ad-client="ca-pub-6111334333458862" data-ad-slot="3820120620"></ins>
                <h3 style="color: rebeccapurple">购买指定商品成为分销商：</h3>
                <div class="layui-form-item">
                    <label class="layui-form-label">分销商购买(个)</label>
                    <div class="layui-input-inline">
                        <input type="text" value="{$data.one_goods}"  name="one_goods" placeholder="指定商品id" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">即购买指定商品即可成为分销商(多商品用英文逗号分隔如1,2)</div>
                </div>
                <ins class="adsbygoogle" style="display:inline-block;width:970px;height:10px;background-color:#f5f5f5" data-ad-client="ca-pub-6111334333458862" data-ad-slot="3820120620"></ins>
                <div class="layui-form-item">
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" onclick="go_sub2()">保存</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<!--遮罩-->
{if $version<3}
<div class="mask">
    <div class="m-box">
        <div class="b-title">温馨提示：</div>
        <p>当前版本不支持此功能，请前往升级到分销版</p>
        <p style="text-align: center"><img src="{__ADMIN_PATH}/images/ku.png" width="100px"></p>
        <a type="button" href="{$buy_url}" target="_blank">立即前往</a>
    </div>
</div>
{/if}
<script src="{__ADMIN_PATH}js/layuiList.js"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layList.form.render();
    function go_sub2() {
        var is_open         = $('input[name=is_open]:checked').val();
        var three_open      = $('input[name=three_open]:checked').val();
        var agent_way       = $('input[name=agent_way]:checked').val();
        var one_percent     = $('input[name=one_percent]').val();
        var two_percent     = $('input[name=two_percent]').val();
        var three_percent   = $('input[name=three_percent]').val();
        var one_recharge    = $('input[name=one_recharge]').val();
        var one_buy         = $('input[name=one_buy]').val();
        var one_goods       = $('input[name=one_goods]').val();
        var url = "{:url('save_data_two')}";
        var data = {
                    'is_open':is_open,
                    'agent_way':agent_way,
                    'one_percent':one_percent,
                    'two_percent':two_percent,
                    'three_percent':three_percent,
                    'one_recharge':one_recharge,
                    'one_buy':one_buy,
                    'one_goods':one_goods,
                    'three_open':three_open,
        };
        $eb.axios.post(url,data).then(function(res){
            if(res.data.code == 200) {
                $eb.$swal('success', res.data.msg);
                setTimeout(function () {
                    window.location.reload();
                },1000);
            }else
                $eb.$swal('error',res.data.msg||'操作失败!');
        });
    }
</script>
{/block}
</body>
</html>